package exception;

public class TryCatchDemo2 {
    public static void main(String[] args) {
        System.out.println("开始");
        try{
            String str = "fdjalsjf;";
            System.out.println(str.length());
            System.out.println(str.charAt(5));
            System.out.println(Integer.parseInt(str));
            System.out.println("!!!!!!!!!!!!!!");
        }catch (NullPointerException|StringIndexOutOfBoundsException e){
            System.out.println("空指针异常或字符串异常");
        }catch(Exception e){
            System.out.println("异常");
        }
        System.out.println("结束");
    }
}
